package com.ruoyi.app.controller;

import com.ruoyi.app.dto.BillAppealDto;
import com.ruoyi.app.dto.MemberInvoiceDto;
import com.ruoyi.app.service.IParkOrderService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * App端 - 订单相关
 */
@Validated
@CrossOrigin
@RestController
@RequestMapping("/app")
public class ParkOrderController extends BaseController {

    @Autowired
    private IParkOrderService parkOrderService;


    /**
     * 获取停车订单列表
     * @return
     */
    @GetMapping("/getParkOrderList")
    public AjaxResult getParkOrderList(String uniqueId, Integer invoiceStatus){
        return success(parkOrderService.getParkOrderList(uniqueId, invoiceStatus));
    }

    /**
     * 获取停车订单详情
     * @return
     */
    @GetMapping("/getParkOrder")
    public AjaxResult getParkOrder(String orderNo){
        return success(parkOrderService.getParkOrder(orderNo));
    }

    /**
     * 申请开票
     * @return
     */
    @PostMapping("/applyInvoice")
    public AjaxResult applyInvoice(@RequestBody MemberInvoiceDto memberInvoiceDto){
        return success(parkOrderService.applyInvoice(memberInvoiceDto));
    }

    /**
     * 账单申诉
     * @return
     */
    @PostMapping("/billAppeal")
    public AjaxResult billAppeal(@RequestBody @Validated BillAppealDto billAppealDto){
        return success(parkOrderService.billAppeal(billAppealDto));
    }
}
